import { useSelector, useDispatch } from "react-redux";

function App(params) {
    // useSelector 获取redux中数据
    const app = useSelector((state) => {
        console.log();
        return state;
    });
    const dispatch = useDispatch(); // dispatch等同于store.dispatch
    return (
        <div>
            <p>count:{app.count}</p>
            <button
                onClick={() => {
                    dispatch({ type: "add" });
                }}>
                count + 1
            </button>
        </div>
    );
}
export default App;
